package com.seeyou.lake.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.viewbinding.ViewBinding
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope

/**
 * @des
 * @date 2021/9/23
 * @author fade
 */
abstract class EmptyBaseFragment <VB : ViewBinding> : Fragment(), CoroutineScope by MainScope() {

    protected val mViewBing: VB by lazy { yourViewBing() }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return mViewBing.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        init()
        setClick()
        onNetListener()
    }

    abstract fun yourViewBing(): VB

    abstract fun init()

    open fun onNetListener() {

    }

    open fun setClick() {

    }
}